//
//  ZSAppViewModel.m
//  设计模式
//
//  Created by 赛 Sir on 2023/10/29.
//

#import "ZSAppViewModel.h"
#import "ZSAppView.h"
#import "ZSModel.h"

@interface ZSAppViewModel ()

@property (nonatomic, weak) UIViewController *currentVC;


@end

@implementation ZSAppViewModel

- (ZSAppViewModel *)initWith:(UIViewController *)cirrentVC {
    if(self = [super init]) {
        self.currentVC = cirrentVC;
        [self setUI];
    }
    return self;

}

- (void)setUI {
    ZSAppView *zsView = [[ZSAppView alloc] initWithFrame:CGRectMake(100, 100, 100, 100)];
    zsView.ActionBlick = ^(NSString * _Nonnull str) {
        
    };
    zsView.viewModel = self;
    [self.currentVC.view addSubview:zsView];
    
    //网络加载数据
    ZSModel *model = [[ZSModel alloc] init];
    model.titleStr = @"你好呀";
    
    //设置数据
    self.titleStr = model.titleStr;
    [self performSelector:@selector(test) withObject:self afterDelay:3];
}

- (void)test {
    self.titleStr = @"测试数据你好呀";
}

@end
